/**
 * 
 */
package com.celephais.common.client;

import java.util.List;

import com.celephais.common.client.model.DataFilter;
import com.celephais.common.client.model.TableColumn;
import com.celephais.common.client.model.TransferObject;
import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * @author Eugene Shen
 * This is a callback interface that will be used by all object-editing
 * Widgets.  This interface can both be used as a signaling mechanism between
 * Widgets (say, when there are multiple-depth items being edited as one such
 * as parent-child relationships), and as an actual to-the-back-end service
 * call.
 * 
 * It's designed this way so Widgets don't really need to know if the object
 * they're handling is top-level or not.  They can simply signal back and
 * assume the owner / caller would have set the correct callback class onto
 * it.
 * 
 * Service calls should probably implement ObjectAccessServiceAsync instead,
 * since that interface is practically identical to this one, with the
 * exception of being parameterized.  Also, it has a corresponding interface
 * in ObjectAccessService, so GWT will be satisfied.
 */
public interface TransferObjectAccessor<T extends TransferObject> {

	void add(T obj, AsyncCallback<Boolean> callback);

	void delete(T obj, AsyncCallback<Boolean> callback);

	void getColumns(AsyncCallback<TableColumn[]> callback);

	void getObjects(int startRow, int rowsCount, DataFilter[] filters,
			String sortColumnName, boolean sortOrder,
			AsyncCallback<List<T>> callback);

	void getCount(DataFilter[] filters, AsyncCallback<Integer> callback);

	void update(T obj, AsyncCallback<Boolean> callback);
	
}
